package com.ruoyi.web.controller.app;
import com.ruoyi.order.domain.app.Vo

        .ProductViewVo;
import com.ruoyi.order.domain.app.Vo.ProductResultVo;
import com.ruoyi.order.service.INewProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

import static com.ruoyi.common.utils.PageUtils.startPage;

/**
 * @author 陈焕然
 * @version 1.0
 */
@Controller
@RequestMapping("/app")

public class NewProductAppController {

    @Autowired
    private INewProductService newProductService;
    @RequestMapping(" /prod/lastedProdPage")
    @ResponseBody
    public ProductResultVo getNewRecommendation(Integer current, Integer size){
        startPage();
        List<ProductViewVo> list = newProductService.getNewRecommendation();
        ProductResultVo resultList = new ProductResultVo();
        resultList.setTotal(newProductService.count());
        resultList.setCurrent(current);
        resultList.setSize(size);
        resultList.setPages(2);
        resultList.setOptimizeCountSql(true);
        resultList.setSearchCount(true);
        resultList.setMaxLimit(null);
        resultList.setRecords(list);
        return resultList;
    }
}
